﻿@model DreamStore.WebShop.ViewModels.EditCustomerDiscountsViewModel
<fieldset><legend>@T("Customer Discounts")</legend>
    <ul>
        @{
            var discountIndex = 0;
        }
        @foreach (var discount in Model.CustomerDiscountProgramEntries) {
            <li><input type="hidden" value="@discount.CustomerDiscountProgram.Id"
                       name="@Html.FieldNameFor(m => m.CustomerDiscountProgramEntries[discountIndex].CustomerDiscountProgram.Id)"/>
                <label for="@Html.FieldNameFor(m => m.CustomerDiscountProgramEntries[discountIndex].IsChecked)">
                    <input type="checkbox" value="true"
                           name="@Html.FieldNameFor(m => m.CustomerDiscountProgramEntries[discountIndex].IsChecked)"
                           id="@Html.FieldNameFor(m => m.CustomerDiscountProgramEntries[discountIndex].IsChecked)"
                        @if (discount.IsChecked) {<text>checked="checked"</text>}/>
                    @string.Format("{0} ({1:P1})",
                     discount.CustomerDiscountProgram.Name,
                     discount.CustomerDiscountProgram.Discount))
                </label>
                @{discountIndex++;}
            </li>
        }
    </ul>
    <br/>
</fieldset>